from building import *

cwd = GetCurrentDir()

CPPPATH = [cwd]

src = Glob('sm_core.c')
src += Glob('*.h')

if GetDepend('STATE_MACHINE_USING_RTTHREAD_PORT'):
    src += Glob('port/rt-thread/sm_port.c')
    CPPPATH += [os.path.join(cwd, 'port/rt-thread')]

if GetDepend('STATE_MACHINE_USING_FREERTOS_PORT'):
    src += Glob('port/freertos/sm_port.c')
    CPPPATH += [os.path.join(cwd, 'port/freertos')]

if GetDepend('STATE_MACHINE_USING_YSF_PORT'):
    src += Glob('port/ysf/sm_port.c')
    CPPPATH += [os.path.join(cwd, 'port/ysf')]

if GetDepend('STATE_MACHINE_USING_NONOS_PORT'):
    src += Glob('port/non_os/sm_port.c')
    CPPPATH += [os.path.join(cwd, 'port/non_os')]

group = DefineGroup('StateMechine', src, depend = ['PROJECT_PKG_USING_STATE_MACHINE'], CPPPATH = CPPPATH)

Return('group')
